package com.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.ssm.dao.ISysLogDao;
import com.ssm.domain.SysFile;
import com.ssm.domain.SysLog;
import com.ssm.service.ISysLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SysLogServiceImpl implements ISysLogService {

    @Autowired
    private ISysLogDao sysLogDao;
    @Override
    public void save(SysLog sysLog) throws Exception {
        sysLogDao.save(sysLog);
    }
/*    @Override
    public List<SysLog> findAll() throws Exception {
        return sysLogDao.findAll();
    }*/
    @Override
    public List<SysLog> findAllsortByDate(Integer page, Integer size) throws Exception {
        PageHelper.startPage(page,size);
        return sysLogDao.findAllsortByDate();
    }

    @Override
    public void deleteAll() throws Exception {
        sysLogDao.deleteAll();
    }

    @Override
    public void deleteSelect(String[] syslogIds) throws Exception {
        for(String syslogId:syslogIds) {
            sysLogDao.deleteById(syslogId);
        }
    }

    //分页
    @Override
    public List<SysLog> findAll(Integer page, Integer size) throws Exception {
        PageHelper.startPage(page,size);
        return sysLogDao.findAll();
    }


}
